package com.huawei123.hasee.cniao5store.adapter.top;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.GridView;

import com.huawei123.hasee.cniao5store.R;
import com.huawei123.hasee.cniao5store.bean.TopBean;
import com.huawei123.hasee.cniao5store.utils.UIUtils;
import com.zhxu.recyclerview.wrapper.HeaderAndFooterWrapper;

import java.util.List;

/**
 * 项目名称：Cniao5Store
 * 类描述：头部设置
 * 创建人：luohao
 * 创建时间：2018/2/5 18:02
 * 修改人：luohao
 * 修改时间：2018/2/5 18:02
 * 修改备注：
 */

public class TopTopWrapper extends HeaderAndFooterWrapper {

    private final GridView gv_title_grid;
    private Context context;
    private List<TopBean.TopTopBean> topTopBeans;

    public TopTopWrapper(Context context, RecyclerView.Adapter adapter) {
        super(adapter);
        this.context = context;
        View headerView = UIUtils.inflate(R.layout.header_top);
        gv_title_grid = (GridView) headerView.findViewById(R.id.mGV_title_grid);
        addHeaderView(headerView);
    }

    /**
     * 设置头部四按钮
     *
     * @param topBean
     */
    public void addDataAll(List<TopBean.TopTopBean> topBean) {
        topTopBeans = topBean;
        TopSubAdapter topSubAdapter = new TopSubAdapter(context, topBean);
        gv_title_grid.setNumColumns(topBean.size());
        gv_title_grid.setAdapter(topSubAdapter);
    }
}
